package newsletterRouter

import (
	"github.com/Sir-yuChen/funAnalyse/api"
	"github.com/Sir-yuChen/funAnalyse/global"
	"github.com/Sir-yuChen/funAnalyse/middleware"
	"github.com/gin-gonic/gin"
)

type CommunicationRouter struct{}

func (co *CommunicationRouter) CommunicationApiRouter(Router *gin.RouterGroup) {
	//commonRouter := Router.Group(global.ROUTER_GROUP_MSG) //.Use(middlewareddleware.CasbinMiddleware()).Use(middleware.JWTAuth())
	commonJwtRouter := Router.Group(global.ROUTER_GROUP_MSG).Use(middleware.JWTAuth()).Use(middleware.CasbinMiddleware())
	api := api.ApiGroupApp.NewsletterApiGroup.CommunicationController
	{
		commonJwtRouter.GET(global.API_CHAT_CREATE_WEBSOCKET.BasePath, middleware.CheckApiResourcesMiddleware(global.API_CHAT_CREATE_WEBSOCKET), api.CreateWebsocket)
		commonJwtRouter.GET(global.API_CHAT_CREATE_ROOM.BasePath, middleware.CheckApiResourcesMiddleware(global.API_CHAT_CREATE_ROOM), api.CreateChatroom)
		commonJwtRouter.GET(global.API_CHAT_SEND_MSG.BasePath, middleware.CheckApiResourcesMiddleware(global.API_CHAT_SEND_MSG), api.SendCommunicationMsg)
		commonJwtRouter.GET(global.API_USER_COMMUNICATION_BASIS.BasePath, middleware.CheckApiResourcesMiddleware(global.API_USER_COMMUNICATION_BASIS), api.GetCommunicationBasis)
		commonJwtRouter.GET(global.API_USER_COMMUNICATION_FRIEND_ADD.BasePath, middleware.CheckApiResourcesMiddleware(global.API_USER_COMMUNICATION_FRIEND_ADD), api.AddCommunicationFriend)
		commonJwtRouter.GET(global.API_USER_FRIEND_ADD.BasePath, middleware.CheckApiResourcesMiddleware(global.API_USER_FRIEND_ADD), api.AddFriend)
		// 修改好友信息，好友状态，好友的信息
		commonJwtRouter.GET(global.API_UPDATE_FRIEND_INFO.BasePath, middleware.CheckApiResourcesMiddleware(global.API_UPDATE_FRIEND_INFO), api.UpdateFriendInfo)
		//删除聊天室 修改聊天室信息
		commonJwtRouter.GET(global.API_UPDATE_BASIS_ROOM_INFO.BasePath, middleware.CheckApiResourcesMiddleware(global.API_UPDATE_BASIS_ROOM_INFO), api.UpdateBasisRoomInfo)
		commonJwtRouter.GET(global.API_READ_CHAT_MSG.BasePath, middleware.CheckApiResourcesMiddleware(global.API_READ_CHAT_MSG), api.ReadChatroomMsg)
	}
}
